#ifndef AI_STRATEGY_H
#define AI_STRATEGY_H

#include "main.h"

class ChessGame;

// 定义走法结构
struct Move
{
    Point from;
    Point to;
    Move(Point f, Point t) : from(f), to(t) {}
};

// AI策略接口
class AIStrategy
{
public:
    virtual ~AIStrategy() = default;
    virtual Move makeMove(const ChessGame &game) = 0;
};

// 简单AI策略(随机走法)
class EasyAIStrategy : public AIStrategy
{
public:
    Move makeMove(const ChessGame &game) override;
};

// 困难AI策略(极大极小值算法)
class HardAIStrategy : public AIStrategy
{
public:
    Move makeMove(const ChessGame &game) override;

private:
    // 评估函数
    int evaluateBoard(const ChessGame &game);
    // 极大极小值搜索
    int minimax(ChessGame game, int depth, bool isMaximizingPlayer, int alpha, int beta);
    // 获取所有可能的走法
    std::vector<Move> getAllValidMoves(const ChessGame &game, PieceColor color);
};

#endif // AI_STRATEGY_H